<%--
  Created by IntelliJ IDEA.
  User: H64
  Date: 2021/4/6
  Time: 16:05
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>用户信息添加</title>
    <link rel="shortcut icon" href="favicon.ico"> <link href="static/plugins/Hplus-v.4.1.0/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="static/plugins/Hplus-v.4.1.0/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="static/plugins/Hplus-v.4.1.0/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="static/plugins/Hplus-v.4.1.0/css/animate.css" rel="stylesheet">
    <link href="static/plugins/Hplus-v.4.1.0/css/style.css?v=4.1.0" rel="stylesheet">

    <!-- 全局js -->
    <script src="static/plugins/Hplus-v.4.1.0/js/jquery.min.js?v=2.1.4"></script>
    <script src="static/plugins/Hplus-v.4.1.0/js/bootstrap.min.js?v=3.3.6"></script>

    <script type="text/javascript">
        // 客户端端浏览器验证
        //通过验证，返回true，如果没有通过验证返回false
        function  checkMe(){
            //验证通过返回标志位
            var canSubmit = true;
            //dao操作

            //用户名验证
          var strUserName =  document.getElementById("username").value;
            if (strUserName && strUserName.trim() != ""){
                //验证通过
                //清空提示信息
                document.getElementById("user-name-label").innerHTML="";
            }else {
                //验证不通过
                canSubmit = false;
                //信息提示
                document.getElementById("user-name-label").innerHTML="用户名不能为空 ！！";
            }
            console.log("验证结果："+canSubmit);


            //密码验证
            var strUserPsw =  document.getElementById("userPsw2").value;
            var strUserPsw2 =  document.getElementById("userPsw").value;

            if (strUserPsw && strUserPsw.trim() != ""){
                //验证通过
                //清空提示信息
                document.getElementById("user-psw-label").innerHTML="";
            }else {
                //验证不通过
                canSubmit = false;
                //信息提示
                document.getElementById("user-psw-label").innerHTML="密码不能为空 ！！";
            }

            //判断确认密码不能空
            if (strUserPsw2 && strUserPsw2.trim() != ""){
                //验证通过
                //清空提示信息
                document.getElementById("user-psw2-label").innerHTML="";
            }else {
                //验证不通过
                canSubmit = false;
                //信息提示
                document.getElementById("user-psw2-label").innerHTML="确认密码不能为空 ！！";
            }

            //两次密码要一致
            if (strUserPsw && strUserPsw2 && strUserPsw == strUserPsw2){
                //验证通过
                //清空提示信息
                document.getElementById("user-psw3-label").innerHTML="";
            }else {
                //验证不通过
                canSubmit = false;
                //信息提示
                document.getElementById("user-psw3-label").innerHTML="两次密码不一致 ！！";
            }

            <!--可选可不选-->
            //联系电话验证
            /*
            var strUserPhone =  document.getElementById("userPhone").value;
            if (strUserPhone && strUserPhone.trim() != ""){
                //验证通过
                //清空提示信息
                document.getElementById("user-phone-label").innerHTML="";
            }else {
                //验证不通过
                canSubmit = false;
                //信息提示
                document.getElementById("user-phone-label").innerHTML="联系电话不能为空 ！！";
            }
            console.log("验证结果："+canSubmit);


            //注册日期验证
            var strUserRegisterDate=  document.getElementById("userRegisterDate").value;
            if (strUserRegisterDate && strUserRegisterDate.trim() != ""){
                //验证通过
                //清空提示信息
                document.getElementById("user-registerdate-label").innerHTML="";
            }else {
                //验证不通过
                canSubmit = false;
                //信息提示
                document.getElementById("user-registerdate-label").innerHTML="注册日期不能为空 ！！";
            }
            console.log("验证结果："+canSubmit);
             */

            return canSubmit;
        }
    </script>
</head>
<body>
<div class="ibox-content">
    <form action="addAndUpdateUserInfo" method="post" class="form-horizontal">
        <div class="form-group">
            <label class="col-sm-2 control-label">用户名</label>
            <div class="col-sm-2">
                <input type="text" id="userName" name="username" class="form-control">
                <span class="help-block m-b-none" id="user-name-label" style="color: #ff0000"></span>
            </div>
        </div>
        <div class="hr-line-dashed"></div>


        <div class="form-group">
            <label class="col-sm-2 control-label">密码</label>
            <div class="col-sm-2">
                <input type="password"  id="userPsw" name="userpsw"  class="form-control">
                <span class="help-block m-b-none">密码有字母，数字，特殊符号组成</span>
                <span class="help-block m-b-none" id="user-psw-label" style="color: #ff0000"></span>

            </div>
        </div>
        <div class="hr-line-dashed"></div>


        <div class="form-group">
            <label class="col-sm-2 control-label">确认密码</label>
            <div class="col-sm-2">
                <input type="password"  id="userPsw2" name="userpsw2"  class="form-control" name="password">
                <span class="help-block m-b-none" id="user-psw2-label" style="color: #ff0000"></span>
                <span class="help-block m-b-none" id="user-psw3-label" style="color: #ff0000"></span>
            </div>
        </div>
        <div class="hr-line-dashed"></div>

        <div class="form-group">
            <label class="col-sm-2 control-label">联系电话</label>
            <div class="col-sm-2">
                <input type="text" id="userPhone" name="usertel" class="form-control">
                <span class="help-block m-b-none" id="user-phone-label"></span>
            </div>
        </div>
        <div class="hr-line-dashed"></div>

        <div class="form-group">
            <label class="col-sm-2 control-label">住址</label>
            <div class="col-sm-2">
                <input type="text" id="userAddress" name="useraddress" class="form-control">
                <span class="help-block m-b-none" id="user-address-label" ></span>
            </div>
        </div>
        <div class="hr-line-dashed"></div>

       <div class="form-group">
            <label class="col-sm-2 control-label">注册日期</label>
            <div class="col-sm-2">
                <input type="date"  id="userRegisterDate"  placeholder="选择注册日期" class="form-control">
                <span class="help-block m-b-none" id="user-registerdate-label" ></span>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-2 control-label">头像</label>

            <div class="col-sm-2">
                <input type="text" id="userimg" name="userimg" class="form-control">
                <span class="help-block m-b-none" id="user-img-label" ></span>
            </div>
        </div>

        <div class="hr-line-dashed"></div>

        <div class="form-group">
            <div class="col-sm-4 col-sm-offset-2">
                <button class="btn btn-primary" type="submit" onclick="return checkMe();">保存内容</button>
                <%--<button class="btn btn-white" type="submit">取消</button>--%>
            </div>
        </div>
    </form>
</div>
</body>
</html>